﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

//Alon
namespace InformationExtraction
{
    class GenderProcess : ExtractorProcess
    {
        public override void Execute(Person person, Page page)
        {
            Regex male = new Regex(@"\bhe\b", RegexOptions.IgnoreCase);
            Regex female = new Regex(@"\bshe\b", RegexOptions.IgnoreCase);
            for (int i = 0; i < page.Sentences.Count; i++)
            {                
                if (male.IsMatch(page.Sentences[i].PlainText))
                {
                    person.Gender = GenderEnum.Male;
                    return;
                }

                if (female.IsMatch(page.Sentences[i].PlainText))
                {
                    person.Gender = GenderEnum.Female;
                    return;
                }
            }
        }
    }
}
